namespace Asmex.FileViewer
{
    using System;
    using System.IO;

    public class MetaDataHeaders : Region
    {
        private MDStreamHeader _blobstr;
        private MDStreamHeader _guidstr;
        private Asmex.FileViewer.StorageSigAndHeader _ssah;
        private MDStreamHeader _strstr;
        private MDStreamHeader _tablestr;
        private MDStreamHeader _usstr;

        public MetaDataHeaders(BinaryReader reader)
        {
            base.Start = reader.BaseStream.Position;
            this._ssah = new Asmex.FileViewer.StorageSigAndHeader(reader);
            for (int i = 0; i < this._ssah.NumOfStreams; i++)
            {
                MDStreamHeader header = new MDStreamHeader(reader);
                if (header.Name == "#Strings")
                {
                    this._strstr = header;
                }
                else if (header.Name == "#Blob")
                {
                    this._blobstr = header;
                }
                else if (header.Name == "#GUID")
                {
                    this._guidstr = header;
                }
                else if (header.Name == "#US")
                {
                    this._usstr = header;
                }
                else if (header.Name == "#~")
                {
                    this._tablestr = header;
                }
                else
                {
                    this._tablestr = header;
                }
            }
            base.Length = reader.BaseStream.Position - base.Start;
        }

        public MDStreamHeader BlobStreamHeader
        {
            get
            {
                return this._blobstr;
            }
        }

        public MDStreamHeader GUIDStreamHeader
        {
            get
            {
                return this._guidstr;
            }
        }

        public Asmex.FileViewer.StorageSigAndHeader StorageSigAndHeader
        {
            get
            {
                return this._ssah;
            }
        }

        public MDStreamHeader StringStreamHeader
        {
            get
            {
                return this._strstr;
            }
        }

        public MDStreamHeader TableStreamHeader
        {
            get
            {
                return this._tablestr;
            }
        }

        public MDStreamHeader USStreamHeader
        {
            get
            {
                return this._usstr;
            }
        }
    }
}
